package com.xunwulian.cmpp.client;


import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import com.google.gson.Gson;
import com.xunwulian.api.iface.AppAPI;
import com.xunwulian.base.constant.ConstantBean;
import com.xunwulian.base.entity.AppEntity;
import com.xunwulian.cmpp.client.handler.CmppClient;
import com.xunwulian.cmpp.client.handler.ServiceProvider;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = "com.xunwulian")
@MapperScan("com.xunwulian.base.dao")
@EnableDubbo
public class CmppClientApplication implements CommandLineRunner {

    @Autowired
    private CmppClient client;

    @Autowired
    private ServiceProvider provider;

    public static void main(String[] args) {
        SpringApplication.run(CmppClientApplication.class, args);
        try {
            Thread.sleep(3600 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run(String... strings) throws Exception {
        client.runService();
        provider.runServer();
    }
}